package com.rrx.service;

import com.rrx.mapper.AddressMapper;
import com.rrx.model.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;


/**
 *
 */
@Service
public class AddressService {
    @Autowired
    AddressMapper addressMapper;
    /**
     * 添加一条地址
     * @param
     * @return
     */
    public Integer addAddress (String province, String city,  String area, String location,String userid,Long time){
        System.out.println("coming service ");
      Integer num= addressMapper.addone(province,city,area,location,userid,time);
        return num;
    }
    /**
     * 删除一条地址
     * @param
     * @return
     */
    public Integer deleAddress (Integer id){
       Integer deleAnum = addressMapper.delOne(id);
        return deleAnum;
    }
    /**
     * 查询一条地址
     * @param
     * @return
     */
    public ArrayList<Address> seleAddress (Integer userid){
        ArrayList addList= addressMapper.getAll(userid);
        return addList;
    }
    /**
     * 修改一条地址
     * @param
     * @return
     */
    public Integer updAddress (String province,String city,String area, String location, String userid){
       Integer updnum = addressMapper.modityone(province,city,area,location,userid);
        return updnum;
    }
}
